﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tencent.OA.App;
using System.Web.Mvc;
using System.Web.Routing;

namespace Tencent.OA.ACM.App
{
    public static class MvcRegistration
    {
        #region // 注册ModelBinders

        public static void RegisterModelBinders(ModelBinderDictionary modelBinders)
        {
            modelBinders.Add(typeof(PagerInfo), new PagerInfoModelBinder());
        }

        #endregion  //注册ModelBinders

        #region // 注册路由

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute("LoginHandler", "login.ashx", new { controller = "Home", action = "SignIn" });
            routes.MapRoute("SignOut", "signout", new { controller = "Home", action = "SignOut" });
            routes.MapRoute("AppError", "error", new { controller = "Home", action = "Error" });
            routes.MapRoute("FileNotFound", "filenotfound", new { controller = "Home", action = "FileNotFound" });
            routes.MapRoute("AccessDeny", "accessdeny", new { controller = "Home", action = "AccessDeny" });

            routes.MapRoute(
              "Default", // Route name
              "{controller}/{action}/{id}", // URL with parameters
              new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );           
        }
        #endregion // end of 注册路由
    }
}
